import { Injectable } from '@angular/core';
import {FrameContext,BindingData,Repository} from '@farris/devkit';

@Injectable()
export class DzyhpQrDetailFrmControllerService {
  constructor(
     private frameContext:FrameContext
  ) {}

  /**
   * 单价绑定字段值变化后事件
   * @remarks 
   * @returns 
   */
  djFieldValueChanged(): any {
    let compentName = 'yhpmx-component';
    let dataGrid = 'dataGrid_yhpmx'
    let dataGridCompent = this.frameContext.appContext.componentManager.get([compentName,dataGrid])

    let data = dataGridCompent.data
    let zj = data
    .map(i => i['sl'] * i['dj'])
    .reduce((p,c) => p + c)

    this.frameContext.bindingData.setValue(['lyzj'],zj,true,true)
  }
}
